package com.opal.qualityControl.controller;


import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import com.opal.qualityControl.entity.SalesorgInBound;
import com.opal.qualityControl.entity.SalesorgOutBound;
import com.opal.qualityControl.form.InDateForm;
import com.opal.qualityControl.service.NotSavedStockListService;
import com.opal.utils.ExcelDownloadUtil;
import com.opal.vo.PageVO;
import org.apache.poi.ss.formula.functions.T;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

//未取数出入库单据
@Controller
@RequestMapping("/notSavedStockList")
public class NotSavedStockListController {

    @Autowired
    private NotSavedStockListService notSavedStockListService;

    /**
     * 获取单据分页
     * @param page
     * @param rows
     * @param selectCodeH
     * @param inDateForm
     * @return
     */
    @RequestMapping("/getNotSavedStockList")
    @ResponseBody
    public PageVO<?> getNotSavedStockList(@RequestParam("page") int page, @RequestParam("rows") int rows, int selectCodeH, InDateForm inDateForm){

        return notSavedStockListService.getNotSavedStockList(page,rows,inDateForm,selectCodeH);
    }


    /**
     * 导出单据Excel
     * @param selectCodeH
     * @param inDateForm
     * @param request
     * @param response
     */
    @RequestMapping("/notSavedStockOutExcel")
    public void notSavedStockOutExcel(int selectCodeH, InDateForm inDateForm, HttpServletRequest request, HttpServletResponse response) throws IOException {
        notSavedStockListService.notSavedStockOutExcel(selectCodeH,inDateForm,request,response);
    }

    @RequestMapping("{page}")
    public String skipPage(@PathVariable("page") String page) {
        return "notSavedStockList/" + page;
    }

}
